public without sharing class PurchaseDemandPlanHandler {

	//采购计划审批判断 
	public static void validate(List<PurchaseDemandPlan__c> list_new ,Map<Id,PurchaseDemandPlan__c> oldMap ){


		for (PurchaseDemandPlan__c p  : list_new ) {
			PurchaseDemandPlan__c old = oldMap.get(p.Id);
			if(p.Status__c == '审批中(子公司负责人已确认)' && old.Status__c != p.Status__c  && p.Comfirm__c != '子公司确认' ){
				p.addError('请先子司负责人确认');

			}
			if(p.Status__c == '审批中(采购专员已修订)' && old.Status__c != p.Status__c  && p.Comfirm__c != '采购确认' ){
				p.addError('请采购确认');
				
			}
		}
		

	
	}

	

    
}